﻿using RabbitMq.core.Service;
using RabbitMQ.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Recive
{
    class Program
    {
        static void Main(string[] args)
        {
            RabbitMq.core.Utils.RabbitMqConfig config = new RabbitMq.core.Utils.RabbitMqConfig();
            config.AmqpLists = new List<RabbitMQ.Client.AmqpTcpEndpoint>() { new AmqpTcpEndpoint(new Uri("amqp://192.168.10.244:5672")) };
            config.UserName = "superrd";
            config.Password = "superrd";
            config.VirtualHost = "/";
            config.ExchangeName = "touchExchange";
            config.RoutingKey = "touchRoutingKey";
            config.ExchangeType = RabbitMq.core.Utils.ExchangeTypeEnum.direct;
            config.DurableMessage = true;
            config.QueueName = "touchQueue";
            config.DurableQueue = true;
            //BaseService mqService = new BaseService();
            //mqService.RabbitConfig = config;
            //
            //mqService.Receive(p.ff);
            Program p = new Program();
            RPCBuniessService buniessService = new RPCBuniessService(config);
            buniessService.ReceiveAndCallBackObject(p.getuser);

            //mqService.channel.Close();
            //mqService.connection.Close();
            Console.ReadLine();

        }

        public bool ff(string ss)
        {
            Console.WriteLine(" [x]1 {0}", ss);
            return true;
        }

        public user getuser(string ss)
        {
            Console.WriteLine(" [x]1 {0}", ss);
            return new user { name = "可乐", age = 4 };
        }
        
    }

    class user
    {
        public string name { get; set; }
        public int age { get; set; }
    }
}
